﻿@using BonjourQuotation.UI.Models.AccountModel
@model ToolTabColumnPermisionsGridViewModel

@if (Model.Message != null)
{
    @Html.LabelForModel(Model.Message)
}
@Html.HiddenFor(model => model.UserID)
@Html.HiddenFor(model => model.ToolTabFixedColumnCountID)
@Html.HiddenFor(model => model.ToolTabID)
@if (Model.ToolID != 3 && Model.ToolID != 1)
{
    <div class="row form-row">
        <div class=" col-lg-4" id="FixedColumnCountDiv">
            <div class="input-group">
                <span class="input-group-addon inpputgrtext table_inputs_SmallPadding2 inpputgrback">@Html.LabelFor(model => model.FixedColumnCount)</span>
                @Html.TextBoxFor(model => model.FixedColumnCount, new { @class = "table_inputs_SmallPadding2 inpputgr form-control ToolElemnetsChange number" })
            </div>
        </div>
    </div>
}
else
{
     <div class="row form-row" style="height:93px"></div>
}
   
    <div style="width: 581px; min-height: 20px; max-height: 360px; margin: auto; padding-top: 10px; padding-bottom: 10px; ">
    <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 560px; background-color: white;">
        <tr>
            <th width=10%; class="GridHeaders">№</th>
            <th width=58%; class="GridHeaders">Tool Tab Column Name</th>
            @if(Model.ToolID != 1)
            { 
                <th width=16%; class="GridHeaders AllowViewth label_pointercursor">
                    <span class="table_inputs_120">Allow View</span>
                    <input type="checkbox" class="table_inputs_checkbox" name="AllowViewCheckbox" id="AllowViewCheckbox" @(Model.Rows.Any(row => row.CanView == false) ? null : new { @checked = "checked" })>
                </th>
            }
            else
            {
                 <th width=16%; class="GridHeaders">
                    <span class="table_inputs_120">Allow View</span>
                     <input type="checkbox" class="table_inputs_checkbox" name="AllowViewCheckbox" id="AllowViewCheckbox" disabled="disabled">
                </th>
            }
            <th width=16%; class="GridHeaders AllowEditth label_pointercursor">
                <span class="table_inputs_120">Allow Edit</span>
                <input type="checkbox" class="table_inputs_checkbox" name="AllowEditCheckbox" id="AllowEditCheckbox" @(Model.Rows.Any(row => row.CanEdit == false) ? null : new { @checked = "checked" })>
            </th>
        </tr>
    </table>
    <div style="height:310px; overflow-y:auto">
        <table class="table table-bordered table-hover table-condensed" style="width: 560px; table-layout: fixed; background-color: white;">
            <tbody>
                @for (int ind = 0; ind < Model.Rows.Count; ind++)
                {
                Model.SelectedToolTabColumnID = Model.Rows[ind].SelectedToolTabColumnID;
                <tr>
                    <td width=10%;>
                        @Html.LabelForModel(Model.Rows[ind].LineNo.ToString(), new { @class = "LineNo table_inputs_small table_inputs_WithoutBox" })
                    </td>
                    @if (Model.ToolID != 3 && Model.ToolID != 1)
                    {
                        <td width=58%;>
                            @Html.DropDownListFor(model => Model.SelectedToolTabColumnID, new SelectList(Model.ToolTabColumnName, "Value", "Text"), new { @class = "table_inputs_320 table_inputs_WithoutBox ToolTabColumnNameDrop LineNoChangeDrop" })
                            @Html.DropDownListFor(model => Model.Rows[ind].SelectedToolTabColumnID, new SelectList(Model.ToolTabColumnName, "Value", "Text"), new { @class = "RoomGridDropHide LineNoChangeDropHide" })
                        </td>
                    }
                    else
                    {
                        <td width=58%; style="overflow:hidden">
                            @Html.DropDownListFor(model => Model.SelectedToolTabColumnID, new SelectList(Model.ToolTabColumnName, "Value", "Text"), new { @class = "table_inputs_340 table_inputs_WithoutBox ToolTabColumnNameDrop LineNoChangeDrop DisabledDropDown", @disabled = "disabled"})
                            @Html.DropDownListFor(model => Model.Rows[ind].SelectedToolTabColumnID, new SelectList(Model.ToolTabColumnName, "Value", "Text"), new { @class = "RoomGridDropHide LineNoChangeDropHide" })
                        </td>
                    }
                    @if (Model.ToolID != 1)
                    { 
                        <td width=16% style="text-align:center">
                            @Html.CheckBoxFor(model => Model.Rows[ind].CanView, new { @class = "table_inputs_checkbox CanView ToolElemnetsChange" })
                        </td>
                    }
                    else
                    {
                         <td width=16% style="text-align:center">
                            @Html.CheckBoxFor(model => Model.Rows[ind].CanView, new { @class = "table_inputs_checkbox CanView ToolElemnetsChange", @disabled="disabled" })
                        </td>
                    }
                    <td width=16% style="text-align:center">
                        @Html.CheckBoxFor(model => Model.Rows[ind].CanEdit, new { @class = "table_inputs_checkbox CanEdit ToolElemnetsChange" })
                    </td>
                </tr>
                }
            </tbody>
        </table>
    </div>
</div>
<div class="SaveCancelDiv">
    <button class="btn14 btn50" type="button" onclick="$('#cboxClose').click()">Cancel</button>
    <button class="btn14 btn50" type="button" id="ToolTabColumnPermissionsSaveBtn">Save</button>
</div>
